Duplicate the TIC strings before NULLing the GObject data.
authorJohn Ralls <jralls@ceridwen.us>
Tue, 8 Aug 2017 20:15:46 +0000 (23:15 +0300)
committerJohn Ralls <jralls@ceridwen.us>
Tue, 8 Aug 2017 20:21:55 +0000 (23:21 +0300)
NULLing the data strings in GObject frees and invalidates the pointers
returned by g_object_get_data so we need our own copy of the values.

modules/input/imquartz.c

index 7e36378c31a7a564f01ef6e0465d93c5e3a755b1..c7bc5d2067ad5f135485d0b61a9d6307a324b4db 100644 (file)
@@ -131,8 +131,8 @@ output_result (GtkIMContext *context,
   gboolean retval = FALSE;
   gchar *fixed_str, *marked_str;
 
-  fixed_str = g_object_get_data (G_OBJECT (win), TIC_INSERT_TEXT);
-  marked_str = g_object_get_data (G_OBJECT (win), TIC_MARKED_TEXT);
+  fixed_str = g_strdup (g_object_get_data (G_OBJECT (win), TIC_INSERT_TEXT));
+  marked_str = g_strdup (g_object_get_data (G_OBJECT (win), TIC_MARKED_TEXT));
   if (fixed_str)
     {
       GTK_NOTE (MISC, g_print ("tic-insert-text: %s\n", fixed_str));
@@ -171,7 +171,8 @@ output_result (GtkIMContext *context,
       if (qc->preedit_str && strlen (qc->preedit_str) > 0)
         retval = TRUE;
     }
-
+  g_free (fixed_str);
+  g_free (marked_str);
   return retval;
 }